package com.tingyun.sign.core.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.tingyun.sign.core.entity.ScPicsBean;

@Repository("picsDao")
public interface PicsDao extends PagingAndSortingRepository<ScPicsBean, Integer>, JpaSpecificationExecutor<ScPicsBean> {

	@Modifying
	@Query(value="delete ScPicsBean t where t.activityId=:activityId and t.companyUserId=:companyUserId")
	public void deleteByAcIdAndUserId(@Param("activityId")Long activityId, @Param("companyUserId")Long companyUserId);

	@Query(value="select t from ScPicsBean t where t.activityId=:activityId and t.companyUserId=:companyUserId")
	public List<ScPicsBean> findByAcIdAndUserId(Long activityId, Long companyUserId);

}
